#ifndef BMSERVER_H
#define BMSERVER_H

#include <QMainWindow>
#include "newbook.h"
#include "dbbook.h"
#include <QMenu>
#include <QAction>
#include <QFileDialog>


namespace Ui {
class BMserver;
}

class BMserver : public QMainWindow
{
    Q_OBJECT

public:
    explicit BMserver(QWidget *parent = 0);
    ~BMserver();

    bool areadyhasSameData(QString &isbn);
    void justedWindowWidth();

signals:
    void newRecordAdded(void);
private slots:
    void on_bt_AddNewBook_clicked();

    void on_tableView_customContextMenuRequested(const QPoint &pos);

    void on_bt_search_clicked();

public slots:
    void newBookFinished(QStringList strlist);
    void deleteItemAction();
    void modifyItemAction();
    void CopyTtemAction();

    void submitModify(const QModelIndex &topLeft,
                      const QModelIndex &bottomRight,
                      const QVector<int> &roles = QVector<int>());

private:
    Ui::BMserver *ui;
    dbBook book_db;
    QSqlTableModel *model;

    QString m_isbnBeforeEdit;

    QMenu *tableviewPopMenu;
    QAction *action_delete;
    QAction *action_modify;
    QAction *action_copyIt;
};

#endif // BMSERVER_H
